package com.itheima.controller;/*
 *@author wenqh
 *@date 2024/4/11 15:45
 *@Description
 */

import org.example.service.IpCountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Controller
@RequestMapping("/books")
public class BookController {

    //读取配置文件的信息
    @Value("${businessCode}")
    private String businessCode;

    @Autowired
    private Environment env;

    @Autowired
    private IpCountService ipCountService;

    @GetMapping
    public String getById(){
        System.out.println("springboot is running...");
        System.out.println(businessCode);
        System.out.println(env.getDefaultProfiles());
        ipCountService.count();
        return "springboot is running...";

    }

}
